home *** CD-ROM | disk | FTP | other *** search
- // The ScrollWindow class is from David S. Joerg (joerg@alliant.mcs.anl.gov)
- // It was posted to the net in 1990 and is in the archives at Purdue and Oregon State.
- // It is a bit of overkill for this application, since in the lineMatrix and
- // symbolMatrix windows we only need to scroll horizontally, and in the legendForm
- // window we only need to scroll vertically. Nevertheless, it works, and it may
- // be handy to be able to shrink the windows down to a very small size.
- // Here is the README file that was posted with it:
- //-------------------------------------------------------------------------------
- // Autoresizing is a very nice Appkit feature. However, for some Views
- // it just doesn't make sense to autoresize. One day I was looking at
- // the IB palette, and I noticed that it was completely resizable, but
- // none of the interior elements changed. When the palette window was
- // smaller than a certain size, >BANG<, a scroller appeared. I'm always
- // low on screen space, so I loved it. ScrollWindow does just about the
- // same thing. If you're using IB, ScrollWindow is easy to use: 1) make
- // your IB Project recognize the ScrollWindow (subclass Window, Parse).
- // 2) change the desired window's class from Window to ScrollWindow. 3)
- // tell the ScrollWindow to becomeScrollWindow at some point in the
- // initialization sequence (at appDidInit time works for me). Or, if
- // you're not using IB, you should just [ScrollWindow new] or
- // [ScrollWindow newContent:blah:blahblah...] and once you've filled the
- // ScrollWindow with Views, tell it to becomeScrollWindow.
- //
- // You _can_ add more Views or do things to your ScrollWindow after
- // you've told it to becomeScrollWindow, but the important thing to
- // remember is that you shouldn't touch [someScrollWindow contentView];
- // rather, you should message [[someScrollWindow contentView] docView].
- // This is because becomeScrollWindow places the old contentView one
- // level lower in the View hierarchy, under a newly-created ScrollView.
- //
- // Unfortunately, a ScrollWindow doesn't send the
- // windowWillResize:toSize: or windowDidResize: messages to its delegate.
- // It is possible (and easy) to make ScrollWindow do this, but I think it
- // would involve NXReponsibleDelegate() and I just didn't want the mess.
- //
- // A trivial, yet elegant, piece of code. Enjoy.
- //
- // David S. Joerg
- // MindShock, Inc.
- // Internet : joerg@alliant.mcs.anl.gov
- //--------------------------------------------------------------------------------
- #import <appkit/Window.h>
-
- @interface ScrollWindow:Window
- { NXSize minFrameSize; }
-
- - becomeScrollWindow;
- - setMinFrameSize:(NXSize) newSize;
- - windowWillResize:sender toSize:(NXSize *)frameSize;
- - windowDidResize:sender;
-
- @end
-